<nav class="navbar navbar-inverse navbar-fixed-top fh-fixedHeader" role="navigation">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <%= link_to 'Home', root_path, class: 'navbar-brand' %>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
        <ul class="nav navbar-nav">
          <%= nav_link "People", people_path %>
          <li class="nav-item dropdown">
            <a class="nav-link split-dropdown dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"><span class="caret"></span></a>
            <ul class="split-dropdown dropdown-menu">
              <%= nav_link "Applicants", applicants_people_path %>
              <%= nav_link "Inactive", inactive_people_path %>
              <%= nav_link "Everybody", everybody_people_path %>
            </ul>
          </li>

          <% if can? :read, Event %>
            <%= nav_link "Events", events_path %>
            <li class="nav-item dropdown">
              <a class="nav-link split-dropdown dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"><span class="caret"></span></a>
              <ul class="split-dropdown dropdown-menu">
                <%= nav_link "Templates", events_templates_path %>
                <%= nav_link "Archives", events_archives_path %>
              </ul>
            </li>
          <% end %>

          <li>
            <%= nav_link "Notifications", notifications_path if can? :read, Notification %>
          </li>

          <li>
            <%= nav_link "Inventory", item_categories_path if can? :read, Item %>
            <li class="nav-item dropdown">
              <a class="nav-link split-dropdown dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"><span class="caret"></span></a>
              <ul class="split-dropdown dropdown-menu">
                <%= nav_link "Vendors", vendors_path if can? :read, Vendor %>
              </ul>
            </li>
          </li>

          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">Admin<span class="caret"></span></a>
            <ul class="dropdown-menu">
              <%= nav_link "Courses", courses_path if can? :read, Course %>
              <%= nav_link "Departments", departments_path if can? :read, Department %>
              <%= nav_link "Skills", skills_path if can? :read, Skill %>
              <%= nav_link "Titles", titles_path if can? :read, Title %>
              <%= nav_link "Locations", locations_path if can? :read, Location %>
              <%= nav_link "Resource Types", resource_types_path if can? :read, ResourceType%>
              <%= nav_link "Item Types", item_types_path if can? :read, ItemType %>
              <%= nav_link "Grants", grants_path if can? :read, Grant %>
              <%= nav_link "Users", users_path if can? :read, User %>
              <%= nav_link "Settings", settings_path if can? :read, Setting %>
            </ul>
          </li>

          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">Reports<span class="caret"></span></a>
            <ul class="dropdown-menu">
              <%= nav_link "Attendance Sheet", signin_people_path %>
              <li class="menu-item dropdown dropdown-submenu">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Org Charts</a>
                <ul class="dropdown-menu">
                  <li>
                    <% Department.active.managing_people.order("shortname ASC").each do |dept| %>
                      <%= nav_link dept.shortname, orgchart_departments_path(dept) %>
                    <% end %>
                  </li>
                </ul>
              </li>
              <%= nav_link 'Calendar Chart', calendar_chart_analytics_path, :get %>
              <%= nav_link "System Activity Logs", system_activity_logs_analytics_path %>
            </ul>
          </li>
        </ul>
        <ul class="nav navbar-nav navbar-right">
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Access<span class="caret"></span></a>
            <ul class="dropdown-menu" >
              <% if user_signed_in? %>
                <%= nav_link "#{current_user.email} Profile", edit_user_registration_path %>
                <%= nav_link "Sign Out", destroy_user_session_path, :delete %>
              <% else %>
                <%= nav_link "Sign In", new_user_session_path %>
              <% end %>
            </ul>
          </li>

          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Help<span class="caret"></span></a>
            <ul class="dropdown-menu" >
              <%= nav_link "Help", help_path %>
              <%#= nav_link "Changelog", "/Changelog.md" %>
            </ul>
          </li>
        </ul>
      </div>
    </div>
</nav>
